package com.sx.jys.app.framework

import androidx.recyclerview.widget.DiffUtil

/**
 * @Description
 * @Author 梁浩文
 * @Date 2022/8/29 18:17
 */
class DiffUtilCallbacks {

    fun <T> getItemCallBack(same: Boolean = true): DiffUtil.ItemCallback<T> {
        return object : DiffUtil.ItemCallback<T>() {
            override fun areItemsTheSame(oldItem: T, newItem: T): Boolean {
                if (same) {
                    return oldItem?.equals(newItem) ?: false
                } else {
                    return false
                }

            }

            override fun areContentsTheSame(oldItem: T, newItem: T): Boolean = false
        }
    }


}